﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Lidgren.Network;
using Microsoft.Xna.Framework;

namespace uam_fps_game.Network.MessageTypes
{
    class SendMessageToAll : MessagePrototype
    {
        string text;
        string senderName;

        public SendMessageToAll(string senderName, string text)
        {
            this.senderName = senderName;
            this.text = text;
        }

        public static Letter ParseMessage(NetIncomingMessage msg)
        {
            Letter letter = new Letter();
            letter.senderName = msg.ReadString(); ;
            letter.receiverName = "SEND_IT_TO_ALL";
            letter.text = msg.ReadString();
            return letter;
        }

        public override void CreateMessage(ref NetOutgoingMessage om)
        {
            om.Write(this.senderName);
            om.Write(this.text);
        }
    }
}

